package com.jk.bgmainconsumer.controller;

import com.jk.damaicommon.entity.TicketEntity;
import com.jk.bgmainconsumer.entity.UserEntity;
import com.jk.bgmainconsumer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @title
 * @description
 * @author 赵优秀
 * @updateTime 2021/9/1 12:06
 * @throws
 */

@RestController
@RequestMapping("user")
public class UserController {
    /**
     * @title 
     * @description 
     * @author 赵优秀 
     * @updateTime 2021/9/2 9:16 
     * @throws 
     */
    @Autowired
    private UserService userService;
    //查询
    @RequestMapping("findUser")
    public List<UserEntity> findUser(UserEntity userEntity){
        return  userService.findUser(userEntity);
    }

    //批量删除
    @RequestMapping("delAll")
    public void delAll(String ids){
        userService.delAll(ids);
    }
    //批量冻结
    @RequestMapping("freezeAll")
    public void freezeAll(String ids){
        userService.freezeAll(ids);
    }
    //逻辑删除
    @RequestMapping("del")
    public void del(Integer id){
        userService.del(id);
    }
    //冻结
    @RequestMapping("freezeUser")
    public void freezeUser(Integer id){
        userService.freezeUser(id);
    }
    //解冻
    @RequestMapping("UnFreezeUser")
    public void UnFreezeUser(Integer id){
        userService.UnFreezeUser(id);
    }
    //回显
    @RequestMapping("getByid")
    public UserEntity getByid(Integer id){
        return userService.getByid(id);
    }
    //修改
    @RequestMapping("updateUser")
    public void updateUser(UserEntity userEntity){
        userService.updateUser(userEntity);
    }
    //查看冻结用户
    @RequestMapping("findFreezeUser")
    public List<UserEntity> findFreezeUser(UserEntity userEntity){
        return  userService.findFreezeUser(userEntity);
    }
     //查看删除用户
    @RequestMapping("findDelUser")
    public List<UserEntity> findDelUser(UserEntity userEntity){
        return  userService.findDelUser(userEntity);
    }
    //恢复用户
    @RequestMapping("onUser")
    public void onUser(Integer id){
        userService.onUser(id);
    }
    //批量回复
    @RequestMapping("onFreezeAll")
    public  void onFreezeAll(String ids){
        userService.onFreezeAll(ids);
    }
    //查询用户优惠券数量
    @RequestMapping("findCoupon")
    public List<UserEntity> findCoupon(){
        return userService.findCoupon();
    }
    /**
     * @title 查询已有的优惠券
     * @description
     * @author 赵优秀
     * @updateTime 2021/9/15 21:17
     * @throws
     */
    @RequestMapping("grantCoupon")
    public List<TicketEntity> grantCoupon(){
        return userService.grantCoupon();
    }
    /**
     * @title 发放优惠券
     * @description
     * @author 赵优秀
     * @updateTime 2021/9/15 22:36
     * @throws
     */
    @RequestMapping("grant")
    public String grant(TicketEntity ticket){
        return userService.grant(ticket);
    }
    /**
     * @title 查询用户拥有的优惠券
     * @description 
     * @author 赵优秀 
     * @updateTime 2021/9/16 10:08 
     * @throws 
     */
    @RequestMapping("userCoupon")
    public List<TicketEntity> userCoupon(Integer id){
        return userService.userCoupon(id);
    }
    
}
